<?php

namespace app\common\model\serve;

use think\Model;


class Serve extends Model
{

    

    

    // 表名
    protected $name = 'serve';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'images_array',
        'image_str',
    ];


    public function getImageStrAttr($v, $d)
    {
        return $d['image'] ? cdnurl($d['image'] , true) : '';
    }
    public function getImagesArrayAttr($value, $data)
    {
        if ($data['images']) {
            $array = explode(',', $data['images']);
            foreach ($array as &$v) {
                $v = cdnurl($v, true);
            }
            return $array;
        }
        return [];
    }





}
